import Vue from 'vue'
import Router from 'vue-router'
import _import from '@/router/_import'
import Layout from '@/views/layout/Layout'


Vue.use(Router)

export const ShopRouterMap = [
    {
        path: '*',
        component: Layout,
        redirect: '/home',
        children: [
            {
                path: 'home',
                name: '香飘飘微商',
                component: _import('home/index'),

            }
        ]
    },
    {
        path: '/user',
        component: Layout,
        redirect: '/user/index',
        children: [
            {
                path: 'index',
                name: '我的',
                component: _import('user/index')
            }
        ]
    }
]

const router = new Router({
    routes: ShopRouterMap
})

router.beforeEach((to, from, next) => {
    const title = to.name
    if (title) {
        document.title = title;
    }
    next();
});

export {
    router
}
